/******************************************************************************
  Some simple Hisilicon Hi3519A system functions.

  Copyright (C), 2017, Hisilicon Tech. Co., Ltd.
 ******************************************************************************
    Modification:  2017-11 Created
******************************************************************************/
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* End of #ifdef __cplusplus */

#include <stdio.h>
#include "hi_type.h"
#include "osal_mmz.h"
#include "asm/io.h"
#include "hi_interdrv_param.h"

#include "stdlib.h"
#include "fcntl.h"
#include "string.h"

/* set liteos's mmz parameter, sync form mpp sdk_init.c */
static unsigned long long mmz_start = 0x42000000;
static unsigned int       mmz_size  = 32;   /* MB*/
/******************************************************************/


static HI_S32 MMZ_init(void)
{
    extern int media_mem_init(void * pArgs);
    MMZ_MODULE_PARAMS_S stMMZ_Param = {0};

    snprintf(stMMZ_Param.mmz, MMZ_SETUP_CMDLINE_LEN, "anonymous,0,0x%llx,%dM", mmz_start, mmz_size);

    stMMZ_Param.anony = 1;

    dprintf("mmz_start=0x%llx, mmz_size=0x%x\n", mmz_start, mmz_size);
    dprintf("mmz param= %s\n", stMMZ_Param.mmz);

    return media_mem_init(&stMMZ_Param);
}

static HI_S32 RTC_init(void)
{
    extern int rtc_mod_init(void);

    return rtc_mod_init();
}

extern void osal_proc_init(void);


HI_VOID SDK_init(void)
{
    HI_S32 ret = 0;

    osal_proc_init();

    ret = MMZ_init();
    if (ret != 0)
    {
        printf("MMZ init error.\n");
    }

    ret = RTC_init();
    if (ret != 0)
    {
        printf("rtc init error.\n");
    }

    printf("SDK init ok...\n");
}


#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */

